<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
	$(function() {
		 $('#error').hide();
		parent.$.messager.progress('close');
		$('#form').form({
			url : '/userController/editOwnPwd',
			onSubmit : function() {
				parent.$.messager.progress({
					title : '提示',
					text : '数据处理中，请稍后....'
				});
				
				var v = $(this).form('validate');
				if(v){
					v = $('input[name="newLoginPwd"]').val() == $('input[name="reNewloginPwd"]').val();
					if(v)  $('#error').hide();
					else  $('#error').show();
				}
				if(!v) parent.$.messager.progress('close');				
				return v ;
			},
			success : function(result) {
				try{
					parent.$.messager.progress('close');
					result = $.parseJSON(result);
					if (result.success) {
						parent.$.messager.alert('错误','密码修改成功', 'info');
						parent.$.modalDialog.handler.dialog('close');
					} else {
						parent.$.messager.alert('错误', result.msg, 'error');
					}
				} catch(e){
						parent.$.messager.alert('错误', result, 'error');
				}
			}
		});
	});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false" title="" style="overflow: hidden;">
		<form id="form" method="post" style="overflow: auto;height: 100%">
			<input name="id" type="hidden" class="span2" value="${user.id}" readonly="readonly">
			<input name="employeeId" type="hidden" class="span2" value="" readonly="readonly">
			<input name="roleIds" type="hidden" class="span2" value="" readonly="readonly">
			
			<table class="table table-hover table-condensed">
				<tr>
					<th style="width:30%;">登录密码</th>
					<td><input name="loginPwd" type="password" placeholder="请输入登录密码" class="easyui-validatebox span2" data-options="required:true"></td>
				</tr>
				<tr>
					<th>新密码</th>
					<td><input name="newLoginPwd" type="password" placeholder="请输入新密码密码" class="easyui-validatebox span2" data-options="required:true" onfocus="$('#error').hide()"></td>
				</tr>
				<tr>
					<th>确认密码</th>
					<td>	
						<input name="reNewloginPwd" type="password" placeholder="请确认密码密码" class="easyui-validatebox span2" data-options="required:true">
						<label id="error" style="color:red;padding-left:20px;">两次密码不一致</label>
					</td>
				</tr>
				
			</table>
		</form>
	</div>
</div>